/*
	Initialize height map
*/

#include "voxel_1.cl"
#include "height_map_common.cl"


kernel void Main (write_only image2d_t outputHeightMap)
{
	const int2	coord	= GetGlobalCoord().xy;
	const int2	size	= (int2)( get_image_width( outputHeightMap ), get_image_height( outputHeightMap ) );
	
	float	height	= 0.0f;
	uint	color	= COLOR_BLACK;

	// is border
	if ( coord.x == 0 or coord.y == 0 or coord.x == size.x-1 or coord.y == size.y-1 )
	{
		height	= 0.0f;
		color	= COLOR_BLACK;
	}
	else
	// is border 2
	if ( coord.x == 1 or coord.y == 1 or coord.x == size.x-2 or coord.y == size.y-2 )
	{
		height	= 1.0f;
		color	= COLOR_WHITE;
	}
	else
	// empty
	{
		height	= 0.5f;
		color	= COLOR_RED;
	}
	
	WriteToHeightMap( outputHeightMap, coord, height, color );
}
